<template>
  <div style="margin-top:20px">
    <router-view v-slot="{Component,route}">
      <transition name="slide-fade">
        <keep-alive>
          <component :is="Component" :key="route.name" v-if="route.meta.keepAlive" />
        </keep-alive>
      </transition>
      <transition name="slide-fade">
        <component :is="Component" v-if="!route.meta.keepAlive" />
      </transition>
    </router-view>
  </div>
</template>
<style type="text/css">
/* 页面进度 */
.slide-fade-enter-active {
  transition: all 0.3s ease-out;
}
.slide-fade-leave-active {
  transition: all 0.3s cubic-bezier(1, 0.5, 0.8, 1);
}
.slide-fade-enter-to {
  transform: translateX(0px);
  opacity: 1;
}
.slide-fade-enter-from,
.slide-fade-leave-to {
  transform: translateX(-50px);
  opacity: 0;
}
</style>